<%--
  Created by IntelliJ IDEA.
  User: lenovo
  Date: 2020/9/11
  Time: 17:09
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<html>
<head>
    <title>支付页面</title>
    <link href="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
    <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div >
    <img src="/imgs/u=2023893501,1869614745&fm=26&gp=0.png" width="100%" height="400">

</div>
<div  class="row clearfix">
    <div class="col-md-12 column">
        <table class="table table-hover table-striped">
            <thead>
            <tr>
                <td>房间编号</td>
                <td>房间类型</td>
                <td>房间的内容</td>
                <td>房间的价格</td>
                <td>房间的状态</td>
            </tr>
            </thead>
            <tbody>
             <tr>
                 <td >${pay.commodityid}</td>
                 <td >${pay.merchandise}</td>
                 <td  >${pay.house}</td>
                 <td >${pay.price}</td>
                 <td  >${pay.person}</td>
            </tr>
            </tbody>
        </table>
    </div>
</div>
<form class="bs-example bs-example-form" role="form">
    <div class="input-group input-group-sm">
        <span class="input-group-addon">请输入你要入住的天数</span>
        <input type="text" id="date" class="form-control" placeholder="请输入你要入住的天数">
    </div>
</form>
<div>
    <form>
        <p>
            <button type="button" class="btn btn-primary btn-lg btn-block" onclick="paymoney(${pay.commodityid},${pay.price},${username})">支付</button>
        </p>
    </form>
</div>
<script type="text/javascript">
    function paymoney(commodityid,price,username) {
        var date=$.trim($("#date").val());
        var  data={
            date:date,
            Ordersfogoods:commodityid,
            price:price,
            username:username
        }
        $.ajax({
            type:"GET",
            url:"/ordert/orderw",
            data:data,
            dataType:'json',
            success:function (data) {
            if ("支付成功"==data){
                alert("支付成功");
                window.location.href="/ordert/defrayed";
            }else{
               alert("支付失败");
            }
            }



        })
    }
</script>
</body>
</html>
